import argparse
from .core import FileOrganizer

def main():
    parser = argparse.ArgumentParser(description="Organize files by type")
    parser.add_argument("path", help="Directory to organize")
    parser.add_argument("--analyze", action="store_true", help="Generate report only")
    args = parser.parse_args()

    organizer = FileOrganizer(args.path)
    organizer.analyze_files()
    
    if args.analyze:
        print("File Type Report:")
        for ext, files in organizer.file_types.items():
            print(f"{ext.upper()}: {len(files)} files")
    else:
        organizer.organize_files()
        print("Files organized successfully!")